package com.zhangqiang.git.opc.opclink.model;

/**
 * 返回结果
 */
public class Result {

    // 标识
    public String code;
    // 说明
    public String msg;
    // 数据
    public Object data;

    public Result(String code,String msg,Object data){
            this.code = code;
            this.msg = msg;
            this.data = data;
    }

    public static Result success(Object data){
        return new Result(ResultCode.SUCCESS.getValue(),ResultCode.SUCCESS.getMsg(),data);
    }

    public static Result fail(Object data){
        return new Result(ResultCode.WARN.getValue(),ResultCode.WARN.getMsg(),data);
    }

    public static Result err(Object data){
        return new Result(ResultCode.ERROR.getValue(),ResultCode.ERROR.getMsg(),data);
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
